<html>
<head>
<title>Inscribe tu colegio</title>
<script type="text/javascript" src="<?php echo base_url("js/jquery.min.js") ?>"></script>
<link rel="stylesheet" href="http://www.teleton.cl/wp-content/themes/Avenue/style.css" type="text/css" />
<link rel="stylesheet" href="<?php echo base_url("css/autocomplete.css") ?>" type="text/css" />
<link href="<?php echo base_url(); ?>html/tables.css" rel="stylesheet" type="text/css">

<script type="text/javascript">
	function checkclear(what){
		if(!what._haschanged){
		  what.value=''
		};
		what._haschanged=true;
	}

//autocomplete

	function lookup_codigo(inputString) {
        if(inputString.length == 0) {
            $('#suggestions').hide();
        } else {
            //base url?
            $.post("<?php echo site_url('/forms/ranking/autocomplete/')?>", {queryString: ""+inputString+""}, function(data){
                if(data.length >0) {
                    $('#suggestions').show();
                    $('#autoSuggestionsList').html(data);
                }
            });
        }
    }

	function redirect_detail(code){
		location.href="<?php echo site_url('/forms/ranking/detail')?>/"+code;
	}
    
    function fill(thisValue) {
    	var arr=new Array();
        arr = thisValue.split('#',2);
        $('#id_input2').val(arr[0]);
        $('#id_input1').val(arr[1]);
        setTimeout("$('#suggestions').hide();", 200);
        setTimeout(redirect_detail(arr[0]), 200);
        
    } 


</script>
</head>
<body>

<div><label>NOMBRE COLEGIO</label>
<input class='text' type="text" id="id_input1" name="nombre" size="40" maxlength="20" onfocus="javascript:checkclear(this);" onkeyup="javascript:lookup_codigo(this.value);" /></div>
<div class="suggestionsBox" id="suggestions" style="display: none;">
    <img src="<?php echo base_url("img");?>/upArrow1.png" class="imgup" alt="upArrow">
    <div class="autoSuggestionsList_l" id="autoSuggestionsList">
    </div>
</div>

<p>
<br>
<table class="table01">
	<tr>
		<th width="50">Ranking</th>
		<th width="500">Colegio</th>
		<th width="50">Puntaje</th>
	</tr>
<?php foreach ($listado as $item):?>
	<tr>
		<td><?php echo $item->ranking ?></td>
		<td><a href="<?php echo site_url('forms/ranking/detail/'.$item->codigo)?>"><?php echo $item->nombre ?></a></td>
		<td align="right"><?php echo $item->puntaje_acumulado ?></td>
	</tr>	
<?php endforeach;?>	
	
	
</table>

<?php echo $paginator; ?>

</body>
</html>